package com.example.network_services;

import java.net.URI;
import java.net.UnknownHostException;

import org.apache.http.client.HttpClient;
import org.apache.http.client.ResponseHandler;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.BasicResponseHandler;
import org.apache.http.impl.client.DefaultHttpClient;

import android.opengl.Visibility;
import android.os.AsyncTask;
import android.os.Bundle;
import android.app.Activity;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.util.Log;
import android.view.Menu;
import android.view.View;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;

public class MainActivity extends Activity {

	//et_url
	//button_get_it
	//et_url_contents
	//tv_label_Text
	
	private EditText givenUrl;
	private Button button;
	private EditText urlContents;
	private TextView labelText;
	
//	private HttpClient client;
//	private HttpGet httpGet;
//	private ResponseHandler<String> handler;
//	
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        
        
        givenUrl = (EditText) findViewById(R.id.et_url);
        button = (Button) findViewById(R.id.button_get_it);
        urlContents = (EditText) findViewById(R.id.et_url_contents);
        labelText = (TextView) findViewById(R.id.tv_label_Text);
        
        button.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				RetrieveDataTask dataTask = new RetrieveDataTask(givenUrl, urlContents, labelText);
				dataTask.execute("http://www.nu.nl");
			}
		});
    }


    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.main, menu);
        return true;
    }
    
}
